
package history.model;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;

import announcement.util.Utilities;
import to.HistoryTO;
import history.model.HistoryDAO;

public class HistoryService {
	@Autowired
	private HistoryDAO dao;
	public HistoryService(HistoryDAO dao){
		this.dao = dao;
	}
	//업데이트
	public void updateHistory(HistoryTO hto)throws SQLException{
		dao.updateHistory(hto);
	}
	//입력
	public void insertHistory(HistoryTO hto)throws SQLException{
		hto.setRatingComment(Utilities.changeRatingCommentForDB(hto.getRatingComment()));
		dao.insertHistory(hto);
	}
	//삭제
	public void deleteHistoryByNO(String no)throws SQLException{
		dao.deleteHistoryByNO(no);
	}
	//전체 조회
	public ArrayList<HistoryTO> getHistoryList(HashMap<String,Object> condition) throws SQLException{
		return dao.selectHistoryByMemberPhone(condition);
	}
}